<script setup>
defineProps({
  title: {
    type: String,
    required: true
  },
  thumbnail: {
    type: String,
    required: true
  },
  views: {
    type: Number,
    default: 0
  },
  duration: {
    type: String,
    default: '00:00'
  }
})
</script>

<template>
  <div class="video-card">
    <div class="thumbnail-container">
      <img :src="thumbnail" :alt="title" class="thumbnail" />
      <span class="duration">{{ duration }}</span>
    </div>
    <div class="video-info">
      <h3 class="title">{{ title }}</h3>
      <div class="stats">
        <span class="views">{{ views }} 次观看</span>
      </div>
    </div>
  </div>
</template>

<style scoped>
.video-card {
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--card-shadow);
  transition: all 0.3s ease;
  cursor: pointer;
}

.video-card:hover {
  transform: translateY(-4px);
}

.thumbnail-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
}

.thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 12px;
}

.video-info {
  padding: 12px;
}

.title {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--text-color);
}

.stats {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-color);
  opacity: 0.7;
}
</style>